package code.lucamarrocco.struts2.rest.sample;

import code.lucamarrocco.rest.RestfulProtocol;

public class Protocol extends RestfulProtocol {
	public Protocol() {
		resource("Protocol");
		{
			GET("/protocol/documents/<name>");
			accomplish("documentation of method that match name. i.e. GET_protocol_documents_name");
			
			GET("/protocol");
			accomplish("resources and methods implemented by protocol");

			GET("/protocol/resources/<name>");
			accomplish("resources implemented by protocol that match name");
			
			GET("/protocol/resources");
			accomplish("resources implemented by protocol");
			
			GET("/protocol/methods/<verb>/<name>");
			accomplish("methods implemented by protocol that match name and verb [GET|POST|PUT|DELETE|...]");
			
			GET("/protocol/methods/<name>");
			accomplish("methods implemented by protocol that match name");
			
			GET("/protocol/methods");
			accomplish("methods implemented by protocol");
		}
		
		resource("People");
		{
			POST("/people");
			accomplish("create person");
			
			GET("/people/<id>");
			accomplish("read person");
			
			PUT("/people/<id>");
			accomplish("update person");
			
			DELETE("/people/<id>");
			accomplish("delete person");
		}

		resource("People Contact");
		{
			POST("/people/<id>/contacts");
			accomplish("create person contact");
			
			GET("/people/<id>/contacts/<contactId>");
			accomplish("read person contact");
			
			PUT("/people/<id>/contacts/<contactId>");
			accomplish("update person contact");
			
			DELETE("/people/<id>/contacts/<contactId>");
			accomplish("delete person contact");
		}
	}
}